package com.clwl.supervise.superviseapp.service.base;

import cn.hutool.core.date.DateUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.clwl.supervise.superviseapp.entity.base.TcCompany;
import com.clwl.supervise.superviseapp.entity.supervise.AdsBaobShareSupTaskDetailEntity;
import com.clwl.supervise.superviseapp.mapper.supervise.AdsBaobShareSupTaskMapper;
import com.clwl.supervise.superviseapp.mapper.supervise.AdsTsYgsbhgxxMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
@DS("ads")
public class AdsDataSourceService {

    @Resource
    private AdsTsYgsbhgxxMapper adsTsYgsbhgxxMapper;

    @Resource
    private AdsBaobShareSupTaskMapper adsBaobShareSupTaskMapper;


    @DS("ads")
    public int getChouyangByLicenseCount(String license,String creditCode) {
        return adsTsYgsbhgxxMapper.getChouyangByLicenseCount(license,creditCode);
    }


    public int getBaobaoRisk(String license) {
        int year = DateUtil.year(new Date());
        return adsBaobShareSupTaskMapper.selectByLicense(license,year);
    }

    public List<AdsBaobShareSupTaskDetailEntity> selectBaobaoRiskContent(TcCompany company) {
        int year = DateUtil.year(new Date());
        return  adsBaobShareSupTaskMapper.selectByCompanyAndYearRisk(company.getLicense(),year);
    }
}
